package com.it.service;

import com.it.mapper.ClReplyMapper;
import com.it.pojo.ClReply;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ClReplyServiceImpl implements ClReplyService {

	//由spring创建对象并为变量赋值
	@Autowired
	private ClReplyMapper clReplyMapper;

	/**
	 * 1.查询所有评价信息
	 * @return
	 */
	public List<ClReply> findAll(){
		//1.调用replyMapper的findAll方法查询所有评价
		List<ClReply> list = clReplyMapper.findAll();
		return list;
	}
	
	/**
	 * 2.根据id删除评价信息
	 * @param id
	 */
	public int deleteById(String id){
		//1.调用ReplyMapper的deleteById方法
		//根据id删除评价信息
		int result = clReplyMapper.deleteById(id);
		return result;
	}
	
	/**
	 * 3.添加评价信息
	 * @param reply
	 */
	public int addClReply(ClReply reply){
		int result = clReplyMapper.addClReply(reply);
		return result;
	}
	
	/**
	 * 4.根据id查询评价信息
	 * @param id
	 * @return 
	 */
	public ClReply findById(String id){
		ClReply reply = clReplyMapper.findById(id);
		return reply;
	}
	
	/**
	 * 5.根据id修改评价信息
	 * @param reply
	 */
	public int updateById(ClReply reply){
		int result = clReplyMapper.updateById(reply);
		return result;
	}
	
}
